package server;

import java.net.Socket;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class HeartBitListener extends Thread{
	private List <Socket> connectedClients;
	private List <Socket> snapshotOfConnectedClients;
	private boolean worked;
	
	public HeartBitListener(List<Socket> connectedClients) {
		super();
		this.connectedClients = connectedClients;
	}
	@Override
	public void run() {
		while (worked){
			snapshotOfConnectedClients=Collections.unmodifiableList(connectedClients);
			Iterator it=snapshotOfConnectedClients.iterator();
			while(it.hasNext()){
				listenHeartBit((String)it.next());
			}
		}
	}
	private void listenHeartBit(String next) {
		//TODO adding listening block, and loging if disconnected
		
	}
	void turnOf(){
		this.worked=false;
	}
	
	
}
